package nayasis.common.ui.javaFx.controller;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.control.ComboBox;

public class NfxCombo {

	private ObservableList<Object> dataBody   = FXCollections.observableArrayList();
	@SuppressWarnings("rawtypes")
	private ComboBox               comboBox   = null;

	@SuppressWarnings({ "rawtypes", "unchecked" })
	public NfxCombo( ComboBox comboBox ) {
		this.comboBox = comboBox;
		this.comboBox.setItems( dataBody );
	}

	public void addItem( Object value ) {
		
		if( dataBody.contains(value) ) return;
		dataBody.add( value );

	}

	public Object getValue() {
		return this.comboBox.getValue();
	}

	@SuppressWarnings("unchecked")
	public void setValue( Object value ) {
		this.comboBox.setValue( value );
	}
	
	public int size() {
		return this.dataBody.size();
	}
	
}
